<?php
/********/
/* live */
/********/

define("T_ADSM_ADS","pms_adsm_ads");
define("T_ADSM_ADS_POSITION","pms_adsm_position");
define("T_ADSM_ADS_TYPE","pms_adsm_type");

/* selection ad(liste)*/
$sql['adsm']['get_all_ads']="SELECT * FROM ".T_ADSM_ADS." ORDER BY ads_name ASC";
$sql['adsm']['get_ads_nb_total']="SELECT COUNT(*) AS nb FROM ".T_ADSM_ADS." ";
$sql['adsm']['get_filtered_ads']="SELECT * FROM ".T_ADSM_ADS." {condition} {order} {limit}";

/* get posotion liste */
$sql['adsm']['get_positions'] = "SELECT * FROM ".T_ADSM_ADS_POSITION."";

/* get type liste */
$sql['adsm']['get_types'] = "SELECT * FROM ".T_ADSM_ADS_TYPE."";

/* selection (details) */
$sql['adsm']['get_ads_details'] = "SELECT * FROM ".T_ADSM_ADS." WHERE ads_id='{id}'";

/* insertion */
$sql['adsm']['insert_ads']="INSERT INTO ".T_ADSM_ADS." 
                            (ads_position_id, ads_type_id, ads_name, ads_file, ads_description, ads_url, ads_publish_date, ads_end_date, ads_width, ads_height, ads_active) 
                            VALUES ('{position}','{type}','{name}', '{file}','{description}','{url}','{pub_date}', '{end_date}','{width}','{height}', '{statut}')";  

# modification
$sql['adsm']['edit_ads']="UPDATE ".T_ADSM_ADS." 
                        SET ads_position_id='{position}',ads_type_id='{type}' , ads_name='{name}', ads_file='{file}',ads_description='{description}',ads_url='{url}' , 
                        ads_publish_date='{pub_date}', ads_end_date='{end_date}', ads_width='{width}', ads_height='{height}'
                        WHERE ads_id='{id}' ";

/* suppression */
$sql['adsm']['delete_ads']="DELETE FROM ".T_ADSM_ADS." WHERE ads_id='{id}'";
?>